package demo.multiLines;

import java.util.ArrayList;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;

public class MultiLinesAction extends ActionSupport {

        private List peopleList;

        public List getPeopleList() {
                return peopleList;
        }

        public void setPeopleList(List peopleList) {
                this.peopleList = peopleList;
        }
        
        public String update() throws Exception{
                for(int i = 0; i < peopleList.size(); i ++){
                        Person p = (Person) peopleList.get(i);
                        System.out.println(p);
                }
                return SUCCESS;
        }
        
        public String addLine() throws Exception{
                if(peopleList == null){
                        peopleList = new ArrayList();
                }
                Person p = new Person();
                peopleList.add(p);
                return SUCCESS;
        }
        
}
